home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEM
/
I-M
/
LineShare DEMO.sea
/
LineShare Scripts
/
Supra Fax2&Hermes
< prev
next >
Wrap
Text File
|
1993-01-28
|
7KB
|
315 lines
!
! LineShare™ Script for Supra modems
! This script is designed for Class 2 fax software and -
! ••• Make sure that you have "H" or better ROMs in your modem!
!
! If you want to modify this script for your modem, pay attention to
! the line marked "#### Settings ####" - it should be modified first
! This script is written to use with the Hermes™ BBS on the "Hermes" subPort:
! this application sets the modem into the "V0" mode.
! This script doesn't set the "V0" mode, but instead - translates all CONNECT
! messages into their numeric values
! This trick is marked with the "$$$" symbols
!
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F1\r"
matchread 20
Write "+++"
DtrClear
pause 10
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
@Label 10
!
! Set the modem preferred speed first
!
SERRESET 2400,0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • X4 -Extended response set
! • N1 -Connect at the highest rate
! • \N3 - Enable MNP/V42 connections (for Hermes)
! • &K4 - Xon/Xoff flow control (for Fax)
!
@Label 11
! #### Settings - change this according to the type of modem you have ####
Write "ATX4N1\\N3&K4\r"
Jsr 100
!
! Set the "work" speed
!
@Label 12
SERRESET 19200,0,8,1
Jsr 80
!
! Set Fax parameters: LID, DCC,BOR
!
Write "AT+FCLASS=2\r"
Jsr 100
Write "AT+FLID=\"Stalker_GmbH\"\r"
Jsr 100
Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
Jsr 100
Write "AT+FBOR=1\r"
Jsr 100
!
! Allow modem to receive fax messages
!
Write "AT+FCR=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after N rings, where N has been set in the control panel (^4)
!
Write "ATS0=^4+FAA=1\r"
Jsr 100
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
@Label 20
MatchClr
matchstr 1 20 "RING\r\n"
matchstr 2 40 "\r\n+FCON"
matchstr 3 10 "\r\nNO "
matchstr 4 10 "\r\nBUSY"
matchstr 5 21 "\r\nCONNECT 1200"
matchstr 6 22 "\r\nCONNECT 2400"
matchstr 7 23 "\r\nCONNECT 4800"
matchstr 8 24 "\r\nCONNECT 7200"
matchstr 9 25 "\r\nCONNECT 9600"
matchstr 10 26 "\r\nCONNECT 12000"
matchstr 11 27 "\r\nCONNECT 14400"
matchstr 12 28 "\r\nCONNECT 19200"
!
Matchread 1200
jump 10
!
! Data connection has been established (we read "CONNECT")
! $$$
! $$$ Put the numeric response back to the buffer and attach the "Data" subPort
! $$$ Since we didn't use "Adjust BPS", we don't adjust the port speed
! $$$ (make sure that your BBS is prepeared to work in this mode
@Label 21
jsr 35
QueueInput "5\r"
Jump 30
@Label 22
jsr 35
QueueInput "10\r"
Jump 30
@Label 23
jsr 35
QueueInput "11\r"
Jump 30
@Label 24
jsr 35
QueueInput "15\r"
Jump 30
@Label 25
jsr 35
QueueInput "12\r"
Jump 30
@Label 26
jsr 35
QueueInput "16\r"
Jump 30
@Label 27
jsr 35
QueueInput "17\r"
Jump 30
@Label 28
jsr 35
QueueInput "14\r"
@Label 30
Attach "Hermes" (DTR,BREAK,Escape,IDLELimit=60)
!
! This routine clears the input buffer (after the CONNECT) till "\r\n"
!
@Label 35
MatchClr
MatchStr 1 36 "\r\n"
MatchRead 10
@Label 36
return
!
! Fax connection has been established (we read "+FCON")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 40
QueueInput "\r\n+FCON"
ifOriginate 41
QueueInput "\r\nRING\r\n"
@Label 41
Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
! ------------------------------------------
! Originating a call through the "Hermes" subport
! ------------------------------------------
@ORIGINATE "Hermes"
!
! Set the Data speed
!
SERRESET 2400,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode
! • N1 to connect at the highest rate
! • S7 is set to 1.5 minute for international calls
! • &S1 should be set if necessary (see above)
!
Write "ATN1S7=90&S1+FCLASS=0\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port
!
Jsr 60
!
! Prepare to receive all error result codes
!
Jsr 90
matchstr 1 21 "\r\nCONNECT"
!
! Dial the number
!
HsReset *
Write "ATD^1\r"
MatchRead 900
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax"
!
! Set the "Fax" speed
!
SERRESET 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! &S0: DSR always on (see above)
!
Write "AT&S0+FCLASS=2\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
! Prepare to receive all error result codes
!
@LABEL 50
Jsr 60
Jsr 90
MatchStr 1 40 "\r\n+FCON"
HsReset *
Write "ATD^1\r"
MatchRead 700
Write "\r"
Exit -6019
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! factory settings + speaker control +
! reset on Dtr drop + DCD valid
! Verbal responses mode, no echo
!
@Label 70
Write "ATM^2L^3&D3&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return